import instance from '@/utils/request'
//上传用户头像
export const userUploadAvatarService = (data, type) => {
  return instance.post('/common/upload', data, {
    params: {
      type
    }
  })
}

//用户注册
export const userRegisterService = (obj) => {
  return instance.post('/expert/register', null, {
    params: {
      ...obj
    }
  })
}

//用户登录
export const userLoginService = (obj) => {
  return instance.post('/expert/login', {
    ...obj
  })
}

//获取Md文件字符串内容
export const userGetMdStrService = (data, userId, type) => {
  return instance.post('/dify/process', data, {
    params: {
      userId,
      type
    }
  })
}

//获取用户信息
export const userGetInfoService = () => {
  return instance.get('/expert/detail')
}

//删除用户头像
export const userDeleteAvatarService = () => {
  return instance.delete('/expert/deleteImage')
}

//修改用户信息
export const userUpdateInfoService = (data) => {
  return instance.put('/expert/update/expert', data)
}

//修改用户密码
export const userUpdatePasswordService = ({ oldPassword, newPassword }) => {
  return instance.put('/expert/updatePassword', null, {
    params: {
      oldPassword,
      newPassword
    }
  })
}
